-------------------------------------------------------------------------------
--	 File name: cl_init.lua
--		Author: Sploder
-- 		  Date: 03/01/2010
-- Description: This file contains the definitions for client-side methods for
--					Sakuyas's normal (RED) knives.
--
-------------------------------------------------------------------------------

-- Includes:
include ('shared.lua')

-- Create a killicon
killicon.Add("sent_proj_sakuyaknife01", "HUD/killicons/sakuya", Color(255, 255, 255, 255))

-------------------------------------------------------------------------------
--	  Function: ENT:Draw()
-- Description: This function is called client-side to draw the entity.
-------------------------------------------------------------------------------
function ENT:Draw()
	--[[local s = 32	-- I think this is the size of the sprite drawn.
	
	local veca = (self:GetPos() + (self:GetLocalAngles():Forward() * 20)):ToScreen()	-- Get the forward edge
	local vecb = (self:GetPos() - (self:GetLocalAngles():Forward() * 20)):ToScreen()	-- Get the back edge
	local x1 = vecb.x - veca.x						-- ?
	local y1 = veca.y - vecb.y						-- ?
	local camAng = math.atan2(y1, x1)				-- ?
	local playerAng = EyeAngles()					-- The angle in which the player is looking.
	local playerVec = playerAng:Forward()			-- The player's forward vector.
	local right = playerAng:Right()					-- The player's right vector.
	local up = playerAng:Up()						-- The player's up vector.
	local vec1 = (right * x1 + up * y1):Normalize() -- The primary direction of the quad.
	local vec2 = vec1:Cross(playerVec):Normalize()	-- The normal vector of vec1 towards the camera.
	local angDif = math.Rad2Deg(math.acos(self:GetLocalAngles():Forward():DotProduct(playerVec))) -- The difference between the entity's direction and the camera's direction?
	
	-- Figure out the frame we need to use based on the difference between the entity's direction and the camera's direction.
	local fr = math.Round(angDif/45)
	fr = fr + 4
	
	-- Make sure that the frame is within range of the number of frames available.
	while (fr > 7)
	do
		fr = fr - 8
	end
	while (fr < 0)
	do
		fr = fr + 8
	end
	fr = math.Clamp(fr, 0, 7)
	
	-- Set the frame to draw.
	self.texture:SetMaterialInt("$frame", fr)
	-- Set the material to use when rendering.
	render.SetMaterial(self.texture)
	-- If the entity is not using one of these frames, multiply the drawing vectors by 64.
	if ((fr != 0) && (fr != 4))
	then
		vec1 = vec1 * s
		vec2 = vec2 * s
	-- Otherwise, use the Right and Up vectors mulitplied by 64.
	else
		vec1 = EyeAngles():Right() * s
		vec2 = EyeAngles():Up() * s
	end
	
	-- Finally, draw the quad.
	render.DrawQuad(self:GetPos() - vec1 + vec2, self:GetPos() + vec1 + vec2, self:GetPos() + vec1 - vec2, self:GetPos() - vec1 -vec2)
	]]
	
	-- Draw the model.
	--self:DrawEntityOutline(0)
	self.Entity:DrawModel()
end

-------------------------------------------------------------------------------
--	  Function: ENT:Think()
-- Description: This function is called every time specified by NextThink.
-------------------------------------------------------------------------------
function ENT:Think()
	-- I don't think anything needs to go here.
	return true
end
